
<?php


 /**
  * WorkDone Value Object.
  * This class is value object representing database table WorkDone
  * This class is intented to be used together with associated Dao object.
  */


class WorkDone {

    /** 
     * Persistent Instance variables. This data is directly 
     * mapped to the columns of database table.
     */
    var $WrkDoneID;
    var $TechAssigned;
    var $DateDone;
    var $Notes;
    var $HrsWorkDone;
    var $TicketID;



    /** 
     * Constructors. 
     * The first one takes no arguments and provides the most simple
     * way to create object instance. The another one takes one
     * argument, which is the primary key of the corresponding table.
     */

    function WorkDone () {

    }

    /* function WorkDone ($WrkDoneIDIn) {

          $this->WrkDoneID = $WrkDoneIDIn;

    } */


    /** 
     * Get- and Set-methods for persistent variables. The default
     * behaviour does not make any checks against malformed data,
     * so these might require some manual additions.
     */

    function getTicketID()
    {
        return $this->TicketID;
    }
    
    function setTicketID($TicketIDIn)
    {
        $this->TicketID = $TicketIDIn;
    }

    function getWrkDoneID() {
          return $this->WrkDoneID;
    }
    function setWrkDoneID($WrkDoneIDIn) {
          $this->WrkDoneID = $WrkDoneIDIn;
    }

    function getTechAssigned() {
          return $this->TechAssigned;
    }
    function setTechAssigned($TechAssignedIn) {
          $this->TechAssigned = $TechAssignedIn;
    }

    function getDateDone() {
          return $this->DateDone;
    }
    function setDateDone($DateDoneIn) {
          $this->DateDone = $DateDoneIn;
    }

    function getNotes() {
          return $this->Notes;
    }
    function setNotes($NotesIn) {
          $this->Notes = $NotesIn;
    }

    function getHrsWorkDone() {
          return $this->HrsWorkDone;
    }
    function setHrsWorkDone($HrsWorkDoneIn) {
          $this->HrsWorkDone = $HrsWorkDoneIn;
    }



    /** 
     * setAll allows to set all persistent variables in one method call.
     * This is useful, when all data is available and it is needed to 
     * set the initial state of this object. Note that this method will
     * directly modify instance variales, without going trough the 
     * individual set-methods.
     */

    function setAll($WrkDoneIDIn,
          $TechAssignedIn,
          $DateDoneIn,
          $NotesIn,
          $HrsWorkDoneIn) {
          $this->WrkDoneID = $WrkDoneIDIn;
          $this->TechAssigned = $TechAssignedIn;
          $this->DateDone = $DateDoneIn;
          $this->Notes = $NotesIn;
          $this->HrsWorkDone = $HrsWorkDoneIn;
    }


    /** 
     * hasEqualMapping-method will compare two WorkDone instances
     * and return true if they contain same values in all persistent instance 
     * variables. If hasEqualMapping returns true, it does not mean the objects
     * are the same instance. However it does mean that in that moment, they 
     * are mapped to the same row in database.
     */
    function hasEqualMapping($valueObject) {

          if ($valueObject->getWrkDoneID() != $this->WrkDoneID) {
                    return(false);
          }
          if ($valueObject->getTechAssigned() != $this->TechAssigned) {
                    return(false);
          }
          if ($valueObject->getDateDone() != $this->DateDone) {
                    return(false);
          }
          if ($valueObject->getNotes() != $this->Notes) {
                    return(false);
          }
          if ($valueObject->getHrsWorkDone() != $this->HrsWorkDone) {
                    return(false);
          }

          return true;
    }



    /**
     * toString will return String object representing the state of this 
     * valueObject. This is useful during application development, and 
     * possibly when application is writing object states in textlog.
     */
    function toString() {

        $out = $out."\nclass WorkDone, mapping to table WorkDone\n";
        $out = $out."Persistent attributes: \n"; 
        $out = $out."WrkDoneID = ".$this->WrkDoneID."\n"; 
        $out = $out."TechAssigned = ".$this->TechAssigned."\n"; 
        $out = $out."DateDone = ".$this->DateDone."\n"; 
        $out = $out."Notes = ".$this->Notes."\n"; 
        $out = $out."HrsWorkDone = ".$this->HrsWorkDone."\n"; 
        return $out;
    }


    /**
     * Clone will return identical deep copy of this valueObject.
     * Here, the retuned cloned object will also have all its attributes cloned.
     */
    function clone1() {
        $cloned = new WorkDone();

        $cloned->setWrkDoneID($this->WrkDoneID); 
        $cloned->setTechAssigned($this->TechAssigned); 
        $cloned->setDateDone($this->DateDone); 
        $cloned->setNotes($this->Notes); 
        $cloned->setHrsWorkDone($this->HrsWorkDone); 

        return $cloned;
    }


}

?>
